Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ValueError in concatenation of result_by_req_id with zero-dimensional arrays, when there are 1-length arrays in the inference result. #20

Closed
wants to merge 7 commits into from

Conversation

pierce-ahn
Copy link

@pierce-ahn pierce-ahn commented May 22, 2024

Description

This PR addresses an issue where the concatenate function encounters zero-dimensional arrays during the processing of result_by_req_id, causing a ValueError. Specifically, the error message observed was:

ValueError: zero-dimensional arrays cannot be concatenated

Example of the problematic result_by_req_id:

result_by_req_id: [[array([b'[[0, 1000, "|\xe3\x82\x8c"], [1020, 180, "|\xe3\x81\xa1\xe3\x82\x87\xe3\x81\xa3\xe3\x81\xa8"], [1220, 180, "|\xe3\x82\xa2\xe3\x83\x97"], [1440, 40, "|\xe3\x81\xa7"], [1500, 80, "|\xe8\xa6\x8b"], [1640, 40, "|\xe3\x81\xa6"], [1700, 180, "|\xe3\x82\x82\xe3\x82\x89\xe3\x81\x86"], [1900, 240, "|\xe3\x81\xa8"]]'], dtype=object), array(0.08090031, dtype=float32)]]

Changes

  • Added safe_concatenate function: This function ensures that any zero-dimensional arrays are expanded to one-dimensional arrays before concatenation.
  • Updated the map function: The map function now uses safe_concatenate to handle each element of zipped_result safely.

@pierce-ahn pierce-ahn changed the title Fix ValueError in concatenation of result_by_req_id with zero-dimensional arrays, when there are 1-length arrays in the inference result. Fix ValueError in concatenation of result_by_req_id with zero-dimensional arrays, when there are 1-length arrays in the inference result. May 22, 2024
@kimdwkimdw
Copy link
Member

kimdwkimdw commented May 22, 2024

Any example model repository for this PR? Please add an example in https://github.com/rtzr/tritony/blob/main/tests/test_model_call.py.

@pierce-ahn pierce-ahn closed this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants